home *** CD-ROM | disk | FTP | other *** search
/ Aminet 45 / Aminet 45 (2001)(GTI - Schatztruhe)[!][Oct 2001].iso / Aminet / game / role / ldmud-3.2-bin.lha / mud / doc / efun / filter_array < prev    next >
Text File  |  2001-04-06  |  2KB  |  51 lines

  1. OBSOLETE
  2. SYNOPSIS
  3.         mixed *filter_array(mixed *arr, string fun, string|object ob,
  4.                             mixed extra, ...)
  5.         mixed *filter_array(mixed *arr, closure cl, mixed extra, ...)
  6.         mixed *filter_array(mixed *arr, mapping map, mixed extra, ...)
  7.  
  8. DESCRIPTION
  9.         Returns an array holding the items of arr filtered through
  10.         ob->fun(element, extra, ...), the closure cl, or the mapping map.
  11.         The function 'fun' in 'ob' resp. the closure 'cl' is called
  12.         for each element in arr with that element as parameter. The
  13.         extra and following parameters are in each call if given.
  14.         The mapping 'map' is likewise indexed by each element.
  15.         If ob->fun(arr[index], extra) returns != 0 resp.
  16.         map[arr[index]] exists, the element is included in the
  17.         returned array.
  18.         
  19.         If arr is not an array, an error occurs.
  20.         
  21.         The extra argument(s) are optional and must not be protected
  22.         references like &(i[0]).
  23.         If <ob> is omitted, or neither a string nor an object, it
  24.         defaults to this_object().
  25.  
  26.         Since 3.2.1@36, the second arg can also be a mapping. Then
  27.         only the elements of the array which belong to the map (as
  28.         keys) will be returned (i.e. map[arr[index]] != 0).
  29.  
  30. EXAMPLE
  31.         int check_if_idle(object user) { return query_idle(user); }
  32.  
  33.         ...
  34.  
  35.         object *idle_users;
  36.  
  37.         idle_users = filter_array(users(), "check_if_idle");
  38.         /* equivalent but smaller and faster */
  39.         idle_users = filter_array(users(), #'query_idle );
  40.  
  41.         Now idle_users contains all users that have been idle for more
  42.         than 1 second.
  43.  
  44. HISTORY
  45.         Since LDMud 3.2.6 obsoleted by efun filter().
  46.         Since LDMud 3.2.9, not available if driver is compiled without
  47.           USE_DEPRECATED.
  48.  
  49. SEE ALSO
  50.         filter(E), filter_objects(E), map(E), map_objects(E)
  51.